import book from 'mbook'

book.init(
				{
				target:document.getElementById('ye'),
				url:'./static/all.txt',  //url,target为必传值
				row:40,
				col:25,
				bg:'wheat',
				fsize:'15px',
				drution:1500,
				fontFamily:'Georgia'
				},function(data){//读取文本完毕返回参数
				var mulus = data.mulu
				cretaedom(mulus)
				document.getElementById('load').style.display = 'none'	
			    }
				)
			book.on({
			'finsh':function(){
				alert('finsh')
			},
			 'firstPage':function(){
			 	alert('one')
			 },
			 'nextPage':function(data){
			 	console.log(data)
			 },
			 'prevPage':function(data){
			 	console.log(data)
			 }
			})
			
function cretaedom(mulus){
				mulus.forEach(function(val,index){
					var odiv = document.createElement('div')
					odiv.innerHTML = val
					odiv.onclick = function(){book.jumpMlu(index)} 
					document.getElementById('left').appendChild(odiv)
				})
			}

document.getElementById('next').onclick = function(){
book.jump()
}
document.getElementById('prev').onclick = function(){
book.prev()
}
